package top.hundreds.oasys.bean.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@Getter
public enum MeetingStatus {

    NO_START(0,"未开始"),
    STARTING(1,"进行中"),
    FINISHED(2,"已结束");

    @JsonValue
    @EnumValue
    private final Integer value;

    private final String label;

    public static MeetingStatus formValue(Object o) {
        if (o != null) {
            for (MeetingStatus meetingStatus : values()) {
                if (meetingStatus.getValue().equals(o)) {
                    return meetingStatus;
                }
            }
        }
        return null;
    }

    public static MeetingStatus formLabel(Object o) {
        if (o != null) {
            for (MeetingStatus meetingStatus : values()) {
                if(meetingStatus.getLabel().equals(o)){
                    return meetingStatus;
                }
            }
        }
        return null;
    }
}
